export default{
  install(Vue,options)
  {
    Vue.prototype.goback = function(){
		this.$router.go(-1);
	}
	Vue.prototype.loaderrimg = function(e){
		e.target.src = '../../static/img/default.png'
	}
	Vue.prototype.loadimg = function(e){
		var _dom = $(e.currentTarget),
			_outdom= _dom.parent(),
			outw = _outdom.width(),
			outh = _outdom.height(),
			w = _dom.width(),
			h = _dom.height(),
			outscale = outw/outh,
			inscale = w/h;
			//外框宽高比大于里面图片时，图片100%高度，否则100%宽度
			if(outscale>inscale){
				_dom.css('height','100%');
				_dom.css('width','auto');
			}else{
				var lasth = outw/inscale;
				var margintop = (outh-lasth)/2;
				_dom.css('width','100%');
				_dom.css('height','auto');
				_dom.css('margin-top',margintop+'px');
			}
		
	}

  }
}